package com.prs.crm.dao.assets;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;

import com.prs.crm.dao.impl.BaseDaoImpl;
import com.prs.crm.domain.assets.ZhejiuScheme;

public class ZhejiuSchemeDaoImpl extends BaseDaoImpl<ZhejiuScheme> implements ZhejiuSchemeDao{

	@SuppressWarnings("unchecked")
	@Override
	public List<ZhejiuScheme> getAllZhejiuScheme() {
		Criteria criteria=this.getSession().createCriteria(ZhejiuScheme.class);
		return criteria.list();
	}

	@Override
	public ZhejiuScheme getZhejiuScheme(final String type) {
		Criteria criteria=this.getSession().createCriteria(ZhejiuScheme.class);
		criteria.add(Restrictions.eq("type", type));
		List result=criteria.list();
		if (result==null || result.size()==0) {
			return null;
		}
		return (ZhejiuScheme) criteria.list().get(0);
	}

}
